#include <cstdio>
#include <vector>

int n, x, y, fa[1000008];
bool ans[1000008];
std::vector<int> edges[1000008];
int st[1000008], top;

inline void dfs(int i) {
	for (auto j : edges[i]) {
		if (!fa[j]) {
			fa[j] = i;
			dfs(j);
		}
	}
}
inline int read() {
	char c;
	int l = 0;
	while ((c = getchar()) < '0' || c > '9');
	l = c - 48;
	while ((c = getchar()) >= '0' && c <= '9') l = (l << 1) + (l << 3) + c - 48;
	return l;
}
inline void write(int i) {
	top = 0;
	while (i) {
		st[++top] = i % 10;
		i /= 10;
	}
	for (int i = top; i >= 1; --i) putchar(st[i] + '0');
	putchar(' ');
}

inline void get_to(int i) {
	ans[i] = 1;
	if (!ans[fa[i]]) get_to(fa[i]);
	write(i);
}

int main() {
	freopen("choice.in", "r", stdin);
	freopen("choice.out", "w", stdout);
	n = read();
	for (int i = 1; i < n; ++i) {
		x = read();
		y = read();
		edges[x].push_back(y);
		edges[y].push_back(x);
	}
	dfs(1);
	ans[1] = 1;
	printf("1 ");
	for (int i = 2; i <= n; ++i) {
		if (!ans[i]) {
			get_to(i);
		}
	}
}
